home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / doors_2 / twview91.zip / MULTPATH.INC < prev    next >
Text File  |  1992-03-11  |  1KB  |  49 lines

  1. const
  2.   MaxMPS = 10;
  3.   Incomplete = true;
  4.  
  5. type
  6.   DistanceTable = array [1..MaxMPS, 1..MaxMPS] of integer;
  7.   SectorVector  = array [1..MaxMPS] of sectorindex;
  8.  
  9. procedure GetDistanceTableData( n : integer;
  10.                             var D : distanceTable;
  11.                             var V : SectorVector );
  12. { read n sectors, and specify the n^2 distances between pairs in D }
  13. var
  14.  i, j : 1..MaxMPS;
  15. begin
  16.   write('Please enter your sector values: ');
  17.   for i := 1 to n do
  18.     V[i] := getsector;
  19.   for i := 1 to n do
  20.     for j := 1 to n do
  21.       if i <> j then
  22.         D[ i, j ] := FixPath( V[i], V[j] );
  23.   for i := 1 to n do
  24.     D[i,i] := 0;
  25. end;
  26.  
  27. procedure MultiPassSector;
  28. { accept a small number of sectors, and find the best path that hits these
  29. sectors (possibly returning to the base sector}
  30. var
  31.   Table      : DistanceTable;
  32.   targets    : SectorVector;
  33.   numsectors : integer;
  34. begin
  35.   if incomplete then
  36.     writeln('Not Yet Implemented.')
  37.   else
  38.     begin
  39.       repeat
  40.         write('How many targets? (0 to abort)  ');
  41.         readln( NumSectors );
  42.       until (NumSectors >= 0) and (NumSectors <= MaxMPS );
  43.       if NumSectors > 0 then
  44.         begin
  45.           GetDistanceTableData( NumSectors, Table, targets );
  46.  
  47.         end;
  48.     end; {done}
  49. end;